﻿using System;
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class Parallelshanktwistarills3
    {
        public static void _Parallelshanktwistarills3(Dictionary<string, Object> data)//细柄丝锥
        { 
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            double scale = 1; //放大系数

            double d = 3;
            double l1 = 66;
            double l = 100;

            //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X + l + 6, v1.Y);
            Vector2 v3 = new Vector2(v1.X + 3, v1.Y);
            Vector2 v4 = new Vector2(v3.X + d / 4, v3.Y + d / 2);
            Vector2 v5 = new Vector2(v3.X + d / 2.953, v3.Y - d / 2);
            Vector2 v6 = fun.Polar(v3, 16 * pi / 180, d / 2.873);
            Vector2 v7 = fun.Polar(v6, -30 * pi / 180, l1 / 15.842);
            Vector2 v9 = fun.Polar(v4, -23 * pi / 180, l1 / 9.577);
            Vector2 v8 = fun.Polar(v9, -23 * pi / 180, l1 / 12.25);
            Vector2 v11 = fun.Polar(v4, -17 * pi / 180, l1 / 7.118);
            Vector2 v10 = fun.Polar(v11, -17 * pi / 180, l1 / 8.6);
            Vector2 v13 = fun.Polar(v4, -11 * pi / 180, l1 / 21.283);
            Vector2 v16 = fun.Polar(v13, 1 * pi / 180, l1 / 16.789);
            Vector2 v14 = fun.Polar(v16, -15 * pi / 180, l1 / 8.928);
            Vector2 v12 = fun.Polar(v14, -21 * pi / 180, l1 / 10.081);
            Vector2 v17 = fun.Polar(v16, -7 * pi / 180, l1 / 7.862);
            Vector2 v15 = fun.Polar(v17, -20 * pi / 180, l1 / 6.808);
            Vector2 v19 = fun.Polar(v16, 0 * pi / 180, l1 / 18.729);
            Vector2 v20 = fun.Polar(v19, -13 * pi / 180, l1 / 5.3545);
            Vector2 v21 = fun.Polar(v19, -6 * pi / 180, l1 / 10.509);
            Vector2 v22 = fun.Polar(v21, -10 * pi / 180, l1 / 5.0286);
            Vector2 v18 = fun.Polar(v22, -18 * pi / 180, l1 / 12.617);
            Vector2 v24 = fun.Polar(v21, 0 * pi / 180, l1 / 11.328);
            Vector2 v25 = fun.Polar(v24, -10 * pi / 180, l1 / 7.367);
            Vector2 v26 = fun.Polar(v24, -8 * pi / 180, l1 / 6.063);
            Vector2 v27 = fun.Polar(v24, 0 * pi / 180, l1 / 10.105);
            Vector2 v28 = fun.Polar(v27, -8 * pi / 180, l1 / 5.894);
            Vector2 v23 = fun.Polar(v28, -21 * pi / 180, l1 / 9.892);
            Vector2 v30 = fun.Polar(v27, 3 * pi / 180, l1 / 12.431);
            Vector2 v31 = fun.Polar(v30, -10 * pi / 180, l1 / 7.419);
            Vector2 v32 = fun.Polar(v30, -9 * pi / 180, l1 / 5.523);
            Vector2 v29 = fun.Polar(v32, -16 * pi / 180, l1 / 7.07);
            Vector2 v34 = fun.Polar(v30, 0 * pi / 180, l1 / 12.887);
            Vector2 v35 = fun.Polar(v34, -8 * pi / 180, l1 / 5.04);
            Vector2 v33 = fun.Polar(v35, -20 * pi / 180, l1 / 7.996);
            Vector2 v37 = fun.Polar(v35, -21 * pi / 180, l1 / 8.909);
            Vector2 v36 = fun.Polar(v34, 2 * pi / 180, l1 / 11.207);
            Vector2 v38 = fun.Polar(v36, 3 * pi / 180, l1 / 19.509);
            Vector2 v39 = fun.Polar(v38, -15 * pi / 180, l1 / 5.679);
            Vector2 v40 = fun.Polar(v39, 3 * pi / 180, l1 / 13.771);
            Vector2 v41 = fun.Polar(v40, 122 * pi / 180, l1 / 49);
            Vector2 v42 = fun.Polar(v38, -9 * pi / 180, l1 / 13.3335);
            Vector2 v43 = fun.Polar(v42, 9 * pi / 180, l1 / 15.724);
            Vector2 v44 = new Vector2(v3.X + l - 0.8, v43.Y);
            Vector2 v45 = new Vector2(v44.X + 0.8, v44.Y - 0.8);
            Vector2 v47 = new Vector2(v44.X, v33.Y);
            Vector2 v46 = new Vector2(v47.X + 0.8, v47.Y + 0.8);
            Vector2 V3 = fun.Polar(v4, -118 * pi / 180, d / 0.946);
            Vector2 V5 = fun.Polar(V3, -49 * pi / 180, d / 0.946);
            Vector2 V7 = fun.Polar(v8, 174 * pi / 180, l1 / 9.066);
            Vector2 V6 = fun.Polar(v4, -78 * pi / 180, d / 1.304);
            Vector2 V1 = new Vector2(V3.X - 3, V3.Y);
            Vector2 V2 = new Vector2(V1.X + l + 6, V1.Y);

            Vector2 v48 = new Vector2(V2.X + d, V2.Y);
            Vector2 v49 = new Vector2(v48.X - d / 2 - 2, v48.Y);
            Vector2 v50 = new Vector2(v48.X + d / 2 + 2, v48.Y);
            Vector2 v51 = new Vector2(v48.X, v48.Y + d / 2 + 2);
            Vector2 v52 = new Vector2(v48.X, v48.Y - d / 2 - 2);
            Vector2 v53 = fun.Polar(v48, -74 * pi / 180, v44.Y - V3.Y);
            Vector2 v54 = fun.Polar(v48, 31 * pi / 180, v44.Y - V3.Y);
            Vector2 v55 = new Vector2(v48.X, v48.Y + v44.Y - V3.Y);
            Vector2 v56 = new Vector2(v53.X, v53.Y + (v44.Y - v47.Y) / 3);
            Vector2 v57 = fun.Polar(v48, -77 * pi / 180, (v4.Y - V5.Y) / 2);
            Vector2 v58 = fun.Polar(v48, 106 * pi / 180, v44.Y - V3.Y);
            Vector2 v59 = fun.Polar(v48, -149 * pi / 180, v44.Y - V3.Y);
            Vector2 v60 = new Vector2(v48.X, v48.Y - v44.Y + V3.Y);
            Vector2 v61 = new Vector2(v58.X, v58.Y - (v44.Y - v47.Y) / 3);
            Vector2 v62 = fun.Polar(v48, 103 * pi / 180, (v4.Y - V5.Y) / 2);
            Vector2 v63 = new Vector2(v48.X, v48.Y - (v4.Y - V5.Y) / 2);
            Vector2 v64 = new Vector2(v48.X, v48.Y - (v4.Y - V5.Y) / 2);

            Vector2 a1 = new Vector2(V1.X, V1.Y - l / 2);
            Vector2 a2 = new Vector2(a1.X + l + 6, a1.Y);
            Vector2 a3 = new Vector2(a1.X + 3, a1.Y);
            Vector2 a4 = new Vector2(a3.X + d / 4, a3.Y + d / 2);
            Vector2 a5 = new Vector2(a3.X + d / 2.953, a3.Y - d / 2);
            Vector2 a6 = fun.Polar(a3, 16 * pi / 180, d / 2.873);
            Vector2 a7 = fun.Polar(a6, -30 * pi / 180, l1 / 15.842);
            Vector2 a9 = fun.Polar(a4, -23 * pi / 180, l1 / 9.577);
            Vector2 a8 = fun.Polar(a9, -23 * pi / 180, l1 / 12.25);
            Vector2 a11 = fun.Polar(a4, -17 * pi / 180, l1 / 7.118);
            Vector2 a10 = fun.Polar(a11, -17 * pi / 180, l1 / 8.6);
            Vector2 a13 = fun.Polar(a4, -11 * pi / 180, l1 / 21.283);
            Vector2 a16 = fun.Polar(a13, 1 * pi / 180, l1 / 16.789);
            Vector2 a14 = fun.Polar(a16, -15 * pi / 180, l1 / 8.928);
            Vector2 a12 = fun.Polar(a14, -21 * pi / 180, l1 / 10.081);
            Vector2 a17 = fun.Polar(a16, -7 * pi / 180, l1 / 7.862);
            Vector2 a15 = fun.Polar(a17, -20 * pi / 180, l1 / 6.808);
            Vector2 a19 = fun.Polar(a16, 0 * pi / 180, l1 / 18.729);
            Vector2 a20 = fun.Polar(a19, -13 * pi / 180, l1 / 5.3545);
            Vector2 a21 = fun.Polar(a19, -6 * pi / 180, l1 / 10.509);
            Vector2 a22 = fun.Polar(a21, -10 * pi / 180, l1 / 5.0286);
            Vector2 a18 = fun.Polar(a22, -18 * pi / 180, l1 / 12.617);
            Vector2 a24 = fun.Polar(a21, 0 * pi / 180, l1 / 11.328);
            Vector2 a25 = fun.Polar(a24, -10 * pi / 180, l1 / 7.367);
            Vector2 a26 = fun.Polar(a24, -8 * pi / 180, l1 / 6.063);
            Vector2 a27 = fun.Polar(a24, 0 * pi / 180, l1 / 10.105);
            Vector2 a28 = fun.Polar(a27, -8 * pi / 180, l1 / 5.894);
            Vector2 a23 = fun.Polar(a28, -21 * pi / 180, l1 / 9.892);
            Vector2 a30 = fun.Polar(a27, 3 * pi / 180, l1 / 12.431);
            Vector2 a31 = fun.Polar(a30, -10 * pi / 180, l1 / 7.419);
            Vector2 a32 = fun.Polar(a30, -9 * pi / 180, l1 / 5.523);
            Vector2 a29 = fun.Polar(a32, -16 * pi / 180, l1 / 7.07);
            Vector2 a34 = fun.Polar(a30, 0 * pi / 180, l1 / 12.887);
            Vector2 a35 = fun.Polar(a34, -8 * pi / 180, l1 / 5.04);
            Vector2 a33 = fun.Polar(a35, -20 * pi / 180, l1 / 7.996);
            Vector2 a37 = fun.Polar(a35, -21 * pi / 180, l1 / 8.909);
            Vector2 a36 = fun.Polar(a34, 2 * pi / 180, l1 / 11.207);
            Vector2 a38 = fun.Polar(a36, 3 * pi / 180, l1 / 19.509);
            Vector2 a39 = fun.Polar(a38, -15 * pi / 180, l1 / 5.679);
            Vector2 a40 = fun.Polar(a39, 3 * pi / 180, l1 / 13.771);
            Vector2 a41 = fun.Polar(a40, 122 * pi / 180, l1 / 49);
            Vector2 a42 = fun.Polar(a38, -9 * pi / 180, l1 / 13.3335);
            Vector2 a43 = fun.Polar(a42, 9 * pi / 180, l1 / 15.724);
            Vector2 a44 = new Vector2(a3.X + l - 1, a43.Y);
            Vector2 a45 = new Vector2(a44.X, a44.Y - 1);
            Vector2 a47 = new Vector2(a44.X, a33.Y);
            Vector2 a46 = new Vector2(a45.X + 1, a45.Y );
            Vector2 a48 = new Vector2(a47.X, a47.Y + 1);
            Vector2 a49 = new Vector2(a46.X, a48.Y);
            Vector2 A3 = fun.Polar(a4, -118 * pi / 180, d / 0.946);
            Vector2 A5 = fun.Polar(A3, -49 * pi / 180, d / 0.946);
            Vector2 A7 = fun.Polar(a8, 174 * pi / 180, l1 / 9.066);
            Vector2 A6 = fun.Polar(a4, -78 * pi / 180, d / 1.304);
            Vector2 A1 = new Vector2(A3.X - 3, A3.Y);
            Vector2 A2 = new Vector2(A1.X + l + 6, A1.Y);




            //作图
            Line line1 = new Line(V1, V2);
            line1.Layer = centre;
            line1.Linetype = Linetype.DashDot;
            line1.LinetypeScale = 3;
            dxf.AddEntity(line1);

            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(V3));
            line2.Vertexes.Add(new LwPolylineVertex(V6));
            line2.Vertexes.Add(new LwPolylineVertex(v4));
            line2.Vertexes.Add(new LwPolylineVertex(V3));
            line2.Vertexes.Add(new LwPolylineVertex(V5));
            line2.Vertexes.Add(new LwPolylineVertex(V7));
            line2.Vertexes[0].Bulge = Math.Tan(31 * pi / 180 / 4);
            line2.Vertexes[4].Bulge = Math.Tan(37 * pi / 180 / 4);
            fun.PolyFill(dxf, line2, 0.1, contour);

            LwPolyline line4 = new LwPolyline();
            line4.Vertexes.Add(new LwPolylineVertex(v4));
            line4.Vertexes.Add(new LwPolylineVertex(v9));
            line4.Vertexes[0].Bulge = Math.Tan(-18 * pi / 180 / 4);
            fun.PolyFill(dxf, line4, 0.1, contour);

            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v20));
            line5.Vertexes.Add(new LwPolylineVertex(v18));
            line5.Vertexes[0].Bulge = Math.Tan(30 * pi / 180 / 4);
            fun.PolyFill(dxf, line5, 0.1, contour);

            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v24));
            line6.Vertexes.Add(new LwPolylineVertex(v25));
            line6.Vertexes.Add(new LwPolylineVertex(v23));
            line6.Vertexes[0].Bulge = Math.Tan(-37 * pi / 180 / 4);
            line6.Vertexes[1].Bulge = Math.Tan(41 * pi / 180 / 4);
            fun.PolyFill(dxf, line6, 0.1, contour);

            LwPolyline line7 = new LwPolyline();
            line7.Vertexes.Add(new LwPolylineVertex(v26));
            line7.Vertexes.Add(new LwPolylineVertex(v23));
            line7.Vertexes[0].Bulge = Math.Tan(35 * pi / 180 / 4);
            fun.PolyFill(dxf, line7, 0.1, contour);

            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(v30));
            line8.Vertexes.Add(new LwPolylineVertex(v31));
            line8.Vertexes.Add(new LwPolylineVertex(v29));
            line8.Vertexes[0].Bulge = Math.Tan(-33 * pi / 180 / 4);
            line8.Vertexes[1].Bulge = Math.Tan(31 * pi / 180 / 4);
            fun.PolyFill(dxf, line8, 0.1, contour);

            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(v39));
            line9.Vertexes.Add(new LwPolylineVertex(v40));
            line9.Vertexes.Add(new LwPolylineVertex(v41));
            line9.Vertexes[0].Bulge = Math.Tan(52 * pi / 180 / 4);
            line9.Vertexes[1].Bulge = Math.Tan(63 * pi / 180 / 4);
            fun.PolyFill(dxf, line9, 0.1, contour);

            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(v35));
            line10.Vertexes.Add(new LwPolylineVertex(v33));
            line10.Vertexes[0].Bulge = Math.Tan(24 * pi / 180 / 4);
            fun.PolyFill(dxf, line10, 0.1, contour);

            LwPolyline line11 = new LwPolyline();
            line11.Vertexes.Add(new LwPolylineVertex(v43));
            line11.Vertexes.Add(new LwPolylineVertex(v44));
            line11.Vertexes.Add(new LwPolylineVertex(v47));
            line11.Vertexes.Add(new LwPolylineVertex(v33));
            fun.PolyFill(dxf, line11, 0.1, contour);

            LwPolyline line12 = new LwPolyline();
            line12.Vertexes.Add(new LwPolylineVertex(v44));
            line12.Vertexes.Add(new LwPolylineVertex(v45));
            line12.Vertexes.Add(new LwPolylineVertex(v46));
            line12.Vertexes.Add(new LwPolylineVertex(v47));
            fun.PolyFill(dxf, line12, 0.1, contour);


            Arc c1 = fun.DrawArc3(V6, V7, v8);
            fun.drawBArc(dxf, c1, 0.1, contour);

            Arc c2 = fun.DrawArc3(v9, v8, v10);
            fun.drawBArc(dxf, c2, 0.1, contour);

            Arc c3 = fun.DrawArc3(v11, v13, v4);
            fun.drawBArc(dxf, c3, 0.1, contour);

            Arc c4 = fun.DrawArc3(v11, v10, v12);
            fun.drawBArc(dxf, c4, 0.1, contour);

            Arc c5 = fun.DrawArc3(v14, v16, v13);
            fun.drawBArc(dxf, c5, 0.1, contour);

            Arc c6 = fun.DrawArc3(v17, v19, v16);
            fun.drawBArc(dxf, c6, 0.1, contour);

            Arc c7 = fun.DrawArc3(v17, v15, v18);
            fun.drawBArc(dxf, c7, 0.1, contour);

            Arc c8 = fun.DrawArc3(v20, v21, v19);
            fun.drawBArc(dxf, c8, 0.1, contour);

            Arc c9 = fun.DrawArc3(v22, v24, v21);
            fun.drawBArc(dxf, c9, 0.1, contour);

            Arc c10 = fun.DrawArc3(v22, v18, v23);
            fun.drawBArc(dxf, c10, 0.1, contour);

            Arc c11 = fun.DrawArc3(v26, v27, v24);
            fun.drawBArc(dxf, c11, 0.1, contour);

            Arc c12 = fun.DrawArc3(v28, v30, v27);
            fun.drawBArc(dxf, c12, 0.1, contour);

            Arc c13 = fun.DrawArc3(v28, v23, v29);
            fun.drawBArc(dxf, c13, 0.1, contour);

            Arc c14 = fun.DrawArc3(v32, v34, v30);
            fun.drawBArc(dxf, c14, 0.1, contour);

            Arc c15 = fun.DrawArc3(v32, v29, v33);
            fun.drawBArc(dxf, c15, 0.1, contour);

            Arc c16 = fun.DrawArc3(v35, v36, v34);
            fun.drawBArc(dxf, c16, 0.1, contour);

            Arc c17 = fun.DrawArc3(v37, v38, v36);
            fun.drawBArc(dxf, c17, 0.1, contour);

            Arc c18 = fun.DrawArc3(v39, v42, v38);
            fun.drawBArc(dxf, c18, 0.1, contour);

            Arc c19 = fun.DrawArc3(v41, v43, v42);
            fun.drawBArc(dxf, c19, 0.1, contour);

            Arc c20 = fun.DrawArc3(v14, v12, v15);
            fun.drawBArc(dxf, c20, 0.1, contour);

            //2
            Line line13 = new Line(v49, v50);
            line13.Layer = centre;
            line13.Linetype = Linetype.DashDot;
            line13.LinetypeScale = 3;
            dxf.AddEntity(line13);

            Line line14 = new Line(v51, v52);
            line14.Layer = centre;
            line14.Linetype = Linetype.DashDot;
            line14.LinetypeScale = 3;
            dxf.AddEntity(line14);

            LwPolyline line15 = new LwPolyline();
            line15.Vertexes.Add(new LwPolylineVertex(v54));
            line15.Vertexes.Add(new LwPolylineVertex(v56));
            line15.Vertexes.Add(new LwPolylineVertex(v53));
            line15.Vertexes.Add(new LwPolylineVertex(v57));
            line15.Vertexes[0].Bulge = Math.Tan(75 * pi / 180 / 4);
            fun.PolyFill(dxf, line15, 0.1, contour);

            LwPolyline line16 = new LwPolyline();
            line16.Vertexes.Add(new LwPolylineVertex(v59));
            line16.Vertexes.Add(new LwPolylineVertex(v61));
            line16.Vertexes.Add(new LwPolylineVertex(v58));
            line16.Vertexes.Add(new LwPolylineVertex(v62));
            line16.Vertexes[0].Bulge = Math.Tan(75 * pi / 180 / 4);
            fun.PolyFill(dxf, line16, 0.1, contour);

            LwPolyline line17 = new LwPolyline();
            line17.Vertexes.Add(new LwPolylineVertex(v63));
            line17.Vertexes.Add(new LwPolylineVertex(v55));
            fun.PolyFill(dxf, line17, 0.1, contour);

            LwPolyline line18 = new LwPolyline();
            line18.Vertexes.Add(new LwPolylineVertex(v60));
            line18.Vertexes.Add(new LwPolylineVertex(v64));
            fun.PolyFill(dxf, line18, 0.1, contour);

            fun.drawcircle(dxf, v48, (v4.Y - V5.Y) / 2, 0.1, contour);

            Arc c21 = fun.DrawArc3(v53, v54, v55);
            fun.drawBArc(dxf, c21, 0.1, contour);

            Arc c22 = fun.DrawArc3(v58, v59, v60);
            fun.drawBArc(dxf, c22, 0.1, contour);

            //3
            Line line19 = new Line(A1, A2);
            line19.Layer = centre;
            line19.Linetype = Linetype.DashDot;
            line19.LinetypeScale = 3;
            dxf.AddEntity(line19);

            LwPolyline line20 = new LwPolyline();
            line20.Vertexes.Add(new LwPolylineVertex(A3));
            line20.Vertexes.Add(new LwPolylineVertex(A6));
            line20.Vertexes.Add(new LwPolylineVertex(a4));
            line20.Vertexes.Add(new LwPolylineVertex(A3));
            line20.Vertexes.Add(new LwPolylineVertex(A5));
            line20.Vertexes.Add(new LwPolylineVertex(A7));
            line20.Vertexes[0].Bulge = Math.Tan(31 * pi / 180 / 4);
            line20.Vertexes[4].Bulge = Math.Tan(37 * pi / 180 / 4);
            fun.PolyFill(dxf, line20, 0.1, contour);

            LwPolyline line21 = new LwPolyline();
            line21.Vertexes.Add(new LwPolylineVertex(a4));
            line21.Vertexes.Add(new LwPolylineVertex(a9));
            line21.Vertexes[0].Bulge = Math.Tan(-18 * pi / 180 / 4);
            fun.PolyFill(dxf, line21, 0.1, contour);

            LwPolyline line22 = new LwPolyline();
            line22.Vertexes.Add(new LwPolylineVertex(a20));
            line22.Vertexes.Add(new LwPolylineVertex(a18));
            line22.Vertexes[0].Bulge = Math.Tan(30 * pi / 180 / 4);
            fun.PolyFill(dxf, line22, 0.1, contour);

            LwPolyline line23 = new LwPolyline();
            line23.Vertexes.Add(new LwPolylineVertex(a24));
            line23.Vertexes.Add(new LwPolylineVertex(a25));
            line23.Vertexes.Add(new LwPolylineVertex(a23));
            line23.Vertexes[0].Bulge = Math.Tan(-37 * pi / 180 / 4);
            line23.Vertexes[1].Bulge = Math.Tan(41 * pi / 180 / 4);
            fun.PolyFill(dxf, line23, 0.1, contour);

            LwPolyline line24 = new LwPolyline();
            line24.Vertexes.Add(new LwPolylineVertex(a26));
            line24.Vertexes.Add(new LwPolylineVertex(a23));
            line24.Vertexes[0].Bulge = Math.Tan(35 * pi / 180 / 4);
            fun.PolyFill(dxf, line24, 0.1, contour);

            LwPolyline line25 = new LwPolyline();
            line25.Vertexes.Add(new LwPolylineVertex(a30));
            line25.Vertexes.Add(new LwPolylineVertex(a31));
            line25.Vertexes.Add(new LwPolylineVertex(a29));
            line25.Vertexes[0].Bulge = Math.Tan(-33 * pi / 180 / 4);
            line25.Vertexes[1].Bulge = Math.Tan(31 * pi / 180 / 4);
            fun.PolyFill(dxf, line25, 0.1, contour);

            LwPolyline line26 = new LwPolyline();
            line26.Vertexes.Add(new LwPolylineVertex(a39));
            line26.Vertexes.Add(new LwPolylineVertex(a40));
            line26.Vertexes.Add(new LwPolylineVertex(a41));
            line26.Vertexes[0].Bulge = Math.Tan(52 * pi / 180 / 4);
            line26.Vertexes[1].Bulge = Math.Tan(63 * pi / 180 / 4);
            fun.PolyFill(dxf, line26, 0.1, contour);

            LwPolyline line27 = new LwPolyline();
            line27.Vertexes.Add(new LwPolylineVertex(a35));
            line27.Vertexes.Add(new LwPolylineVertex(a33));
            line27.Vertexes[0].Bulge = Math.Tan(24 * pi / 180 / 4);
            fun.PolyFill(dxf, line27, 0.1, contour);

            LwPolyline line28 = new LwPolyline();
            line28.Vertexes.Add(new LwPolylineVertex(a43));
            line28.Vertexes.Add(new LwPolylineVertex(a44));
            line28.Vertexes.Add(new LwPolylineVertex(a45));
            line28.Vertexes.Add(new LwPolylineVertex(a46));
            line28.Vertexes.Add(new LwPolylineVertex(a49));
            line28.Vertexes.Add(new LwPolylineVertex(a48));
            line28.Vertexes.Add(new LwPolylineVertex(a47));
            line28.Vertexes.Add(new LwPolylineVertex(a33));
            fun.PolyFill(dxf, line28, 0.1, contour);


            Arc c23 = fun.DrawArc3(A6, A7, a8);
            fun.drawBArc(dxf, c23, 0.1, contour);

            Arc c24 = fun.DrawArc3(a9, a8, a10);
            fun.drawBArc(dxf, c24, 0.1, contour);

            Arc c25 = fun.DrawArc3(a11, a13, a4);
            fun.drawBArc(dxf, c25, 0.1, contour);

            Arc c26 = fun.DrawArc3(a11, a10, a12);
            fun.drawBArc(dxf, c26, 0.1, contour);

            Arc c27 = fun.DrawArc3(a14, a16, a13);
            fun.drawBArc(dxf, c27, 0.1, contour);

            Arc c28 = fun.DrawArc3(a17, a19, a16);
            fun.drawBArc(dxf, c28, 0.1, contour);

            Arc c29 = fun.DrawArc3(a17, a15, a18);
            fun.drawBArc(dxf, c29, 0.1, contour);

            Arc c30 = fun.DrawArc3(a20, a21, a19);
            fun.drawBArc(dxf, c30, 0.1, contour);

            Arc c31 = fun.DrawArc3(a22, a24, a21);
            fun.drawBArc(dxf, c31, 0.1, contour);

            Arc c32 = fun.DrawArc3(a22, a18, a23);
            fun.drawBArc(dxf, c32, 0.1, contour);

            Arc c33 = fun.DrawArc3(a26, a27, a24);
            fun.drawBArc(dxf, c33, 0.1, contour);

            Arc c34 = fun.DrawArc3(a28, a30, a27);
            fun.drawBArc(dxf, c34, 0.1, contour);

            Arc c35 = fun.DrawArc3(a28, a23, a29);
            fun.drawBArc(dxf, c35, 0.1, contour);

            Arc c36 = fun.DrawArc3(a32, a34, a30);
            fun.drawBArc(dxf, c36, 0.1, contour);

            Arc c37 = fun.DrawArc3(a32, a29, a33);
            fun.drawBArc(dxf, c37, 0.1, contour);

            Arc c38 = fun.DrawArc3(a35, a36, a34);
            fun.drawBArc(dxf, c38, 0.1, contour);

            Arc c39 = fun.DrawArc3(a37, a38, a36);
            fun.drawBArc(dxf, c39, 0.1, contour);

            Arc c40 = fun.DrawArc3(a39, a42, a38);
            fun.drawBArc(dxf, c40, 0.1, contour);

            Arc c41 = fun.DrawArc3(a41, a43, a42);
            fun.drawBArc(dxf, c41, 0.1, contour);

            Arc c42 = fun.DrawArc3(a14, a12, a15);
            fun.drawBArc(dxf, c42, 0.1, contour);


            //标注

            double height = 5;
            double arrowsize = 1;
            double exline = 2;




            fun.dimrot1(dxf, v5, v4, 90, d, 1, height, arrowsize, exline, "d=" + d, "", "");

            fun.dimrot1(dxf, v3, v40, 180, d * 5, 1, height, arrowsize, exline, "l1=" + l1, "", "");

            fun.dimrot1(dxf, v3, v46, 180, d * 10, 1, height, arrowsize, exline, "l=" + l, "", "");






            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}